package com.yysoft.core.utils;

import com.yysoft.core.model.SysUser;

import javax.servlet.http.HttpServletRequest;

public class UserSessionUtils {

    private static final String SESSION_KEY = "USER_SESSION";

    public static void setUserSession(HttpServletRequest request, SysUser user) {
        request.getSession().setAttribute(SESSION_KEY, user);
    }

    public static SysUser getUserSession(HttpServletRequest request) {
        return (SysUser) request.getSession().getAttribute(SESSION_KEY);
    }

    public static void removeUserSession(HttpServletRequest request) {
        request.getSession().removeAttribute(SESSION_KEY);
    }

}
